fix: apply unresolved PR2 review suggestions#3
Conversation
…queue validation)" Agent-Logs-Url: https://github.com/Algodons/agentos/sessions/5c427c7f-c6a3-407b-860f-916d0b08a58b Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR addresses previously unacted Copilot review items by fixing a README encoding artifact, aligning container/Kubernetes non-root execution settings, and adding stricter runtime option validation in the WASM execution utilities.
Changes:
- Fix a corrupted character in the README feature list.
- Run the Docker image as the
nodeuser and align KubernetessecurityContextwith UID/GID 1000. - Add input validation for
WorkerPool.maxQueueSizeandWasmRunnertimeout configuration.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Replaces corrupted glyph with the intended emoji in the feature list. |
| Dockerfile | Ensures runtime is non-root by chowning /app and switching to USER node. |
| deploy/k8s/base/deployment.yaml | Sets runAsUser/runAsGroup to match the container’s non-root user. |
| core/wasm/workerPool.ts | Validates maxQueueSize as a non-negative safe integer before assignment. |
| core/wasm/wasmRunner.ts | Validates timeout options and enforces maxTimeoutMs >= defaultTimeoutMs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| RUN chown -R node:node /app | ||
| USER node |
| const rawMaxQueueSize = normalized.maxQueueSize ?? concurrency * 100; | ||
| if (!Number.isSafeInteger(rawMaxQueueSize) || rawMaxQueueSize < 0) { | ||
| throw new Error('WorkerPool: maxQueueSize must be a non-negative safe integer'); | ||
| } | ||
| this.maxQueueSize = rawMaxQueueSize; |
| const defaultTimeoutMs = options.defaultTimeoutMs ?? 10_000; | ||
| const maxTimeoutMs = options.maxTimeoutMs ?? 60_000; | ||
|
|
||
| if (!Number.isFinite(defaultTimeoutMs) || defaultTimeoutMs <= 0) { | ||
| throw new Error('WasmRunner: defaultTimeoutMs must be a positive finite number'); | ||
| } | ||
| if (!Number.isFinite(maxTimeoutMs) || maxTimeoutMs <= 0) { | ||
| throw new Error('WasmRunner: maxTimeoutMs must be a positive finite number'); | ||
| } | ||
| if (maxTimeoutMs < defaultTimeoutMs) { | ||
| throw new Error('WasmRunner: maxTimeoutMs must be >= defaultTimeoutMs'); | ||
| } |
|
@copilot apply changes based on the comments in this thread |
…n unit tests Agent-Logs-Url: https://github.com/Algodons/agentos/sessions/43d197d7-ea70-4f58-bb0d-e8ca0714edc8 Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Algodons/agentos/sessions/43d197d7-ea70-4f58-bb0d-e8ca0714edc8 Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Applied all three review comments in commit
|
…tra chown layer Agent-Logs-Url: https://github.com/Algodons/agentos/sessions/66b4d71e-9b39-41cc-98ba-f3fd4b3f8018 Co-authored-by: SMSDAO <144380926+SMSDAO@users.noreply.github.com>
Done in commit
|
Five unresolved Copilot review comments from PR #2 were never acted on before merge. This addresses all of them, plus follow-up improvements based on subsequent review feedback.
Changes
README.md
••(bad encoding) with🤖on line 25Dockerfile + Kubernetes
USER nodebeforeWORKDIR /appin the runner stage so Docker creates/appalready owned by thenodeuser — no extrachownlayer neededCOPY --chown=node:nodefor all artifacts in the runner stage;npm ci --omit=devruns asnoderunAsUser: 1000/runAsGroup: 1000to the pod-levelsecurityContextin the K8s Deployment to satisfyrunAsNonRoot: truecore/wasm/workerPool.tsmaxQueueSizeis a non-negative safe integer; throws on-1,NaN,Infinity, etc.core/wasm/wasmRunner.tsdefaultTimeoutMsandmaxTimeoutMsare positive finite numbersmaxTimeoutMs >= defaultTimeoutMsat construction timetests/workerPool.load.test.tsmaxQueueSizevalues (-1,NaN,Infinity, fractional) throw the expected errortests/wasm.determinism.test.tsWasmRunner constructor validationsuite covering non-positive/non-finitedefaultTimeoutMs, non-positive/non-finitemaxTimeoutMs, andmaxTimeoutMs < defaultTimeoutMs